package com.epin.util;

import com.epin.business.commons.service.ForeignKeyService;
import com.feilong.core.Validator;

public class CheckUtil {
	
	/**
	 * <p>判断指定表的某条记录是否可删除</p>
	 * 
	 * @param tableName 待检表名
	 * @param id 记录ID
	 * 
	 * @return boolean
	 * 
	 * @author fujiajun
	 * @since 2017-09-08
	 */
	public static boolean checkRecordCanDelete(String tableName, String id) {
		
		ForeignKeyService service = SpringUtils.getBean(ForeignKeyService.class);
		
		if (Validator.isNullOrEmpty(service)) {
			return false;
		}
		
		return !service.checkRecordIsQuoted(tableName, id);
	}
    
	
}
